<template>
    <div>
        <van-address-list
            v-model="chosenAddressId"
            :list="list"
            :disabled-list="disabledList"
            disabled-text="以下地址超出配送范围"
            @add="onAdd"
            @edit="onEdit"
        />
        
    </div>
</template>

<script>
import { Toast } from 'vant';
export default {
    data() {
        return {
            chosenAddressId: '1',
            list: [],
            disabledList: []
        }
    },

    methods: {
        onAdd() {
            this.$router.push({path: '/address/addressEdit/999'})
        },

        onEdit(item, index) {
            this.$router.push({path: `/address/addressEdit/${index}`})
        }
    },
    mounted() {
        Toast.loading({
            mask: true,
            message: '加载中...',
            duration: 1,
            onClose: () => {
                this.list = this.$store.state.user.list
                this.disabledList = this.$store.state.user.disabledList
            }
        })
    }
}
</script>

<style lang="less" scoped>

</style>